package com.mmz.spring.aop.support;

import java.util.regex.Matcher;
import java.util.regex.Pattern;


import com.mmz.spring.aop.MethodMatcher;
import com.mmz.spring.aop.Pointcut;
import com.mmz.spring.utils.StringUtils;

public class JdkRegexpMethodPointcut implements Pointcut {

	private Pattern[] compiledPatterns = new Pattern[0];
	
	private String[] patterns = new String[0];
	
	public void setPattern(String pattern) {
		setPatterns(pattern);
	}
	public String[] getPatterns() {
		return this.patterns;
	}
	public void setPatterns(String... patterns) {
		
		this.patterns = new String[patterns.length];
		for (int i = 0; i < patterns.length; i++) {
			this.patterns[i] = patterns[i];
		}
		
	}
	
	public MethodMatcher getMethodMatcher() {
		// TODO Auto-generated method stub
		return null;
	}
	
	protected boolean matches(String pattern, int patternIndex) {
		Matcher matcher = this.compiledPatterns[patternIndex].matcher(pattern);
		return matcher.matches();
	}

}
